<template>
	<view class="pre-box">
		<view class="title">
			发票预览
		</view>
		<image :src="orderInfo.image" mode="widthFix" class="preImg" @tap="$common.previewImage(0,[orderInfo.image])"></image>
		
		<view class="subbox" >
			<text @click="$go('/showcase/showcase/refundInvoice?id=' +id)">申请退票</text>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				orderInfo: {},
				userInfo: this.$db.get('userInfo'),
				id: ''
			}
		},
		onLoad(e) {
			if (e.id) {
				this.id = e.id || ''
				this.getOrderInfo(e.id)
			} else {
				this.$common.errorToShow('参数异常')
			}
		},
		methods:{
			getOrderInfo(id){
				this.$api.default.request('invoice/getDea', {
					id: id
				}).then((res) => {
					if (res.code) {
						this.orderInfo = res.data
					} else {
						this.$common.errorToShow(res.msg)
					}
				})
			},
			kefu(){
				wx.openCustomerServiceChat({
				  extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcf6e13cdfaad774ff'},
				  corpId: 'wwff81ee3e67679806',
				  success(res) {},
				  fail(err){
					  console.log('err',err)
				  }
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: rgba(242, 245, 242, 1);
	}
	
	.preImg{
		display: block;
		width: 100%;
	}
	
	.pre-box{
		padding: 0 30rpx;
		
		.title{
			padding-top: 40rpx;
			padding-bottom: 20rpx;
			font-family: '思源黑体';
			font-size: 12px;
			color: #999999;
		}
		
		image{
			display: block;
			width: 100%;
		}
	}
	.subbox {
		position: fixed;
		bottom: 0;
		left: 0;
		padding-top: 10px;
		padding-bottom: calc(var(--window-bottom) + 10px);
		background-color: #fff;
		display: flex;align-items: center;
		justify-content: center;
		width: 100%;
		
		text{
			width: 630rpx;
			height: 86rpx;
			border-radius: 8px;
			opacity: 1;
			background: #45C4B0;
			text-align: center;
			line-height: 86rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #FFFFFF;
		}
	}
</style>